<template>
  <div class="writeoff">
    <div class="header">
      <span class="title">提货详情</span>
    </div>
    <div class="header-a"></div>
    <div class="writeofflist">
      <div class="toptext">
        <span class="icons">
          <img :src="images8" class="images8">
        </span>
        <span class="companyname">华夏黉</span>
        <span class="time"></span>
      </div>
      <ul class="cartlist-bigbox">
        <li class="cartlist-box" v-if="showss">
          <div class="paymentgoods">
            <div class="paymentgoods-box">
              <div class="paymentgoods-picture">
                <img :src="JSON.parse(shop.goodsPic)" class="imgs">
              </div>
              <div class="paymentgoods-title">
                <div class="paymentgoods-title-introduce">{{shop.goodsName}}{{shop.goodsIntro}}</div>
                <div class="paymentgoods-title-category">典藏版（彩色）</div>
              </div>
            </div>
          </div>
          <div class="totalprice">合计：￥{{shop.payPrice/100}}</div>
          <div class="texts">
            <span class="surereaives" @click="surereaive()" v-if="sure">确认提货</span>
            <span class="reaivecompletes" v-else>订单完成</span>
          </div>
        </li>
        <li class="cartlist-box" v-for="item in list" :key="item.id">
          <div class="paymentgoods">
            <div class="paymentgoods-box">
              <!-- <div class="int">
                <input type="checkbox" id="name">
              </div>-->
              <div class="paymentgoods-picture">
                <img :src="JSON.parse(item.goodsPic)" class="imgs">
              </div>
              <div class="paymentgoods-title">
                <div class="paymentgoods-title-introduce">{{item.goodsName}}{{item.goodsIntro}}</div>
                <div class="paymentgoods-title-category">典藏版（彩色）</div>
                <div class="totalnum">提货时间</div>
              </div>
              <div class="text">
                <span class="reaivecomplete">订单完成</span>
              </div>
            </div>
          </div>
        </li>
      </ul>
    
        <div class="background" v-show="show"></div>

        <div class="bigbox" v-show="show">
          <div class="top">提示</div>
          <div class="toptitle">提取商品</div>
          <div class="bottoms">
            <div class="bottomleft" @click="nodetele">取消</div>
            <div class="bottomright" @click="reaivesure">确认</div>
          </div>
        </div>
  
    </div>
  </div>
</template>

<script>
import pic8 from "../../../icons/shop.png";
import * as api from "../../../request/api.js";
export default {
  name: "Writeoff",
  data() {
    return {
      images8: pic8,
      sure: true,
      show: false,
      pickUpToken: '',
      shop: "",
      showss: "",
      list: [],
      transactionStatus: ""
    };
  },
  created() {
   this.pickUpToken=this.$route.query.pickUpToken
    this.$http({
      method: "post",
      url: api.PICKUPLIST,
      data: {
        pageNo: 1,
        pageSize: 10
      },
      headers: {
        shopWorkerToken: localStorage.getItem("shoptoken")
      }
    })
      .then(resp => {
        console.log(resp);
        this.list = resp.data.data;
      })
      .catch(resp => {
        console.log(resp);
      });
    if (this.pickUpToken != null) {
      this.$http({
        method: "post",
        url: api.SCANPICK,
        data: {
          pickUpToken: this.pickUpToken
        },
        headers: {
          shopWorkerToken: localStorage.getItem("shoptoken")
        }
      })
        .then(resp => {
          console.log(resp, resp.data.data);
          this.shop = resp.data.data;
        })
        .catch(resp => {
          console.log(resp);
        });
      this.showss = true;
    } else {
      this.showss = false;
    }
  },
  methods: {
    surereaive() {
      this.show = !this.show;
    },
    nodetele() {
      this.show = false;
    },
    reaivesure() {
      this.sure = false;
      this.show = false;
      this.$http({
        method: "post",
        url: api.CONFIRMPICKUP,
        data: {
          pickUpToken: this.pickUpToken
        },
        headers: {
          shopWorkerToken: localStorage.getItem("shoptoken")
        }
      })
        .then(resp => {
          console.log(resp);
          alert(resp.data.msg);
          window.location.reload();
        })
        .catch(resp => {});
    }
  }
};
</script>
<style lang="less" scoped>
@import "../../../less/Writeoff.less";
.imgs {
  width: 100%;
  height: 100%;
}
</style>
